package fy.form.groovy;

import com.seeyon.ctp.common.AppContext;
import fy.mybatis.hr.manager.HRUserManager2;
import fy.mybatis.hr.po.HrUser;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author Administrator
 */
public class GroovyFunc_HRUser9 {

    private static Log log = LogFactory.getLog(GroovyFunc_HRUser9.class);

    private static void printError(Exception e) {
//        log.error("GroovyFunc_HRUser 发生异常", e);
//        e.printStackTrace();
    }

    public static String getName(Object o) {
        try {
            if (o != null) {
                Object[] temp = (Object[]) o;
                String code = (String) temp[0];
                if (code != null && code.length() == 6) {
                    HrUser user = HRUserManager2.getUserByCode((String) code);
                    return user == null ? "" : user.getName();
                }
            }
        } catch (Exception e) {
            printError(e);
        }
        return "";
    }

    public static String getDept(Object o) {
        try {
            if (o != null) {
                Object[] temp = (Object[]) o;
                String code = (String) temp[0];
                if (code != null && code.length() == 6) {
                    HrUser user = HRUserManager2.getUserByCode((String) code);
                    return user == null ? "" : user.getDept();
                }
            }
        } catch (Exception e) {
            printError(e);
        }
        return "";
    }

    public static String getAccount(Object o) {
        try {
            if (o != null) {
                Object[] temp = (Object[]) o;
                String code = (String) temp[0];
                if (code != null && code.length() == 6) {
                    HrUser user = HRUserManager2.getUserByCode((String) code);
                    return user == null ? "" : user.getAccount();
                }
            }
        } catch (Exception e) {
            printError(e);
        }
        return "";
    }
    
    public static String getPost(Object o) {
        try {
            if (o != null) {
                Object[] temp = (Object[]) o;
                String code = (String) temp[0];
                if (code != null && code.length() == 6) {
                    HrUser user = HRUserManager2.getUserByCode((String) code);
                    return user == null ? "" : user.getPost();
                }
            }
        } catch (Exception e) {
            printError(e);
        }
        return "";
    }
    
    public static String getJoinDate(Object o) {
        try {
            if (o != null) {
                Object[] temp = (Object[]) o;
                String code = (String) temp[0];
                if (code != null && code.length() == 6) {
                    HrUser user = HRUserManager2.getUserByCode((String) code);
                    return user == null ? "" : user.getJoinDate();
                }
            }
        } catch (Exception e) {
            printError(e);
        }
        return "";
    }
    public static String getTel(Object o) {
        try {
            if (o != null) {
                Object[] temp = (Object[]) o;
                String code = (String) temp[0];
                if (code != null && code.length() == 6) {
                    HrUser user = HRUserManager2.getUserByCode((String) code);
                    return user == null ? "" : user.getTel();
                }
            }
        } catch (Exception e) {
            printError(e);
        }
        return "";
    }
}
